<script setup>
import { reactive } from 'vue'
import { addArticle } from '@/api/article';

const submitForm = reactive({
  title: '',
  content: '',
  id: 2
})

const submitData = async () => {
    const res = await addArticle(submitForm)
    console.log('res',res)
}

</script>

<template>
  <div>
    <h1>发布文章</h1>
    <el-form
      class="loginForm"
      :model="submitForm"
      style="max-width: 600px"
    >
      <el-form-item label="标题">
        <el-input v-model.trim="submitForm.title" />
      </el-form-item>
      <el-form-item label="内容">
        <el-input v-model.trim="submitForm.content" :rows="2"
        type="textarea" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitData">新增</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<style scoped></style>
